package com.xmall.controller.admin;

import com.xmall.bean.vo.BaseRespVo;
import com.xmall.bean.table.Comment;
import com.xmall.bean.vo.CommentVO;
import com.xmall.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Connor
 * @ClassName: CommentController
 * @PackageName: com.xmall.controller
 * @date 2020/12/06
 * @Version 1.0
 */
@RestController
@RequestMapping("admin/comment")
public class CommentController {

    @Autowired
    CommentService commentService;

    @GetMapping("list")
    public BaseRespVo queryCommentList(Integer page, Integer limit, Integer userId, Integer valueId, String sort, String order) {
        CommentVO commentVO = commentService.queryCommentList(page, limit, userId, valueId, sort, order);
        return BaseRespVo.ok(commentVO);
    }

    @PostMapping("delete")
    public BaseRespVo deleteComment(@RequestBody Comment comment) {
        commentService.deleteComment(comment);
        return BaseRespVo.ok();
    }
}
